home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / ae / code / ax3.00 / receiveplaypen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-01-03  |  1.9 KB  |  62 lines

  1. #include "bbs.h"
  2.  
  3. void ReceivePlayPen(void)
  4. {
  5.  BPTR FLock;
  6.  struct FileInfoBlock *Fib;
  7.  char *s;
  8.  int cnt = 0;
  9.  Online_NFiles=0;
  10.  TBT=0;
  11.  strcpy(RecFileNames,"");
  12.  if(Sopt->RamPen[0]!=NULL) sprintf(GSTR1,"%s/",Sopt->RamPen);
  13.  else  sprintf(GSTR1,"%sPlaypen",NodeStr);
  14.  
  15.  if((Fib = (struct FileInfoBlock *)AllocDosObject(DOS_FIB,NULL)) == NL) {
  16.      MyError(0);     return;
  17.  }
  18.    /* lock the directory (Playpen or RamPen */
  19.  if((FLock = Lock(GSTR1,ACCESS_READ)) == 0) {
  20.      MyError(8);     goto fx;
  21.  }
  22.  
  23.  if((Examine(FLock,Fib)) == 0) {
  24.      MyError(6);     goto fx;
  25.  }
  26.  
  27.  if(Fib->fib_DirEntryType > 0) {   /* make sure we locked a directory */
  28.      while(ExNext(FLock,Fib)) {
  29.          if(Fib->fib_DirEntryType < 0) {   /* found a file */
  30.              /* or we can change to &Fib->fib_FileName[0] */
  31.              if(strlen(Fib->fib_FileName) == 0) {   /* check for filename > 0 length */
  32.                  ErrorLog("(cpp - 631) Strlen\n");
  33.                  goto fx;
  34.              }
  35.  
  36.              cnt = 0;
  37.              s = Fib->fib_FileName;
  38.              while(*s && cnt < 30) {     /* check for valid file name */
  39.                  if(*s == ' ') {     /* check for spaces at beginning of filename */
  40.                      goto fx;
  41.                  }
  42.                  if(*s == '/') {
  43.                      goto fx;
  44.                  }
  45.                  if(!(isascii((int) *s))) {
  46.                      goto fx;
  47.                  }
  48.                  cnt++;
  49.                  s++;
  50.              }
  51.              Online_NFiles++; TBT +=Fib->fib_Size;
  52.              strcat(RecFileNames,Fib->fib_FileName); strcat(RecFileNames," ");
  53.  
  54.          }                       /* end if(Fib->fib_DirEntryType < 0)  */
  55.      }                           /* end while(ExNext(FLock,Fib))       */
  56.  }                               /* end if(Fib->fib_DirEntryType > 0)  */
  57.  
  58. fx: ;
  59.   if(FLock) UnLock(FLock);
  60.   if(Fib) FreeDosObject(DOS_FIB,Fib);
  61. }
  62.